<template>
    <div class="authorityManage">
        <div class="authority">
            <div class="authority_item" v-for="item in roleList" :key="item.id" :style="{'border-left':`4px solid ${item.color}`}">
                <div class="authority_item_header">
                    <div class="authority_icon" :style="{background: item.color}">
                        <i :class="item.icon"></i>
                    </div>
                    <div class="authority_right">
                        <div class="authority_right_wrap">
                            <span class="authority_role">{{item.name}}</span>
                            <span class="authority_number" :style="{color: item.color}">{{item.count || '0'}} 人</span>
                        </div>
                        <div class="role_content">
                            {{item.describe}}
                        </div>
                    </div>
                </div>
                <div class="authority_item_btn">
                    <el-button size="small" @click="goToURL('authorityList',{role_id: item.id})">查看列表</el-button>
                    <el-button size="small" @click="goToURL('authorityConfig',{role_id: item.id})" :disabled="item.id == 1">权限组管理</el-button>
                    <el-button size="small" @click="goToURL('authorityOperation',{pageType:'create',role_id:item.id})">新增</el-button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import http from '@/api/role'
export default {
    name: 'authorityManage',
    data() {
        return {
            roleList: []
        }
    },
    methods: {
        goToURL(name,params){
            console.log('params:',params)
            this.$router.push({name, params});
        },
        getList(){
            http.getList().then(res=>{
                console.log('res:',res);
                this.roleList = res.data.data;
            })
        }
    },
    created(){
        this.getList();
    }
}
</script>

<style lang="scss" scoped>
.authorityManage{
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
    overflow: auto;
    &::-webkit-scrollbar {
        width: 6px;
        height: 6px;
        cursor: pointer;
        background: #f1f1f1;
    }

    &::-moz-scrollbar {
        display: none;
    }
    &::-ms-scrollbar {
        display: none;
    }
    &::-o-scrollbar {
        display: none;
    }

    &::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
        border-radius: 10px;
        width: 10px;
        cursor: pointer;
        background: #bbb;
    }
    &::-webkit-scrollbar-track {/*滚动条里面轨道*/
        border-radius: 0px;
        background: #f1f1f1;
    }
    .authority{
        display: flex;
        flex-wrap: wrap;
        &_item{
            width: 328px;
            height: 171px;
            margin-right: 54px;
            margin-bottom: 56px;
            border-left: 4px solid #1796EB;
            border-radius: 6px;
            padding: 23px 16px 0px;
            background: #fff;
            box-sizing: border-box;
            &_header{
                padding-bottom: 13px;
                border-bottom: 1px solid rgba(238,238,238,1);
                display: flex;
                .authority_icon{
                    width: 69px;
                    height: 69px;
                    background:linear-gradient(0deg,rgba(23,180,235,1) 0%,rgba(23,149,235,1) 100%);
                    border-radius:50%;
                    text-align: center;
                    margin-right: 11px;
                    &>i{
                        font-size: 36px;
                        color: #fff;
                        line-height: 69px;
                    }
                }
                .authority_right{
                    flex: 1;
                    &_wrap{
                        padding-top: 16px;
                        .authority_role{
                            font-size: 22px;
                            font-family:PingFang SC;
                            font-weight:500;
                            color:#333333;
                            line-height:22px;
                        }
                        .authority_number{
                            font-size: 17px;
                            line-height: 17px;
                            color: #1796EB;
                        }
                    }
                    .role_content{
                        font-size: 14px;
                        line-height: 32px;
                        color:rgba(153,153,153,1);
                        width: 210px;
                        overflow: hidden;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                    }
                }
            }
            &_btn{
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding-top: 16px;
            }
        }
    }
}
</style>